import time

from selenium import webdriver
from ykao.Page.Page import Page
import unittest,logging
from ykao.Page.Page2 import Page2
from ykao.Page.Page3 import Page3
from ddt import ddt,file_data

class Test_kid(unittest.TestCase):
    def setUp(self):
        self.dr=webdriver.Firefox()
        logging.debug('用例执行前执行')
        self.dr.maximize_window()
    def tearDown(self):
        self.dr.quit()
        logging.debug('用例执行后执行')
    def test_001(self):
        try:
            ba=Page(self.dr)
            logging.debug('执行第一条用例')
            ba.yx()
        except Exception as e:
            s = time.strftime('%Y%m%d%H%M%S')
            self.dr.save_screenshot(s+'.png')
            print(e)
    def test_002(self):
        try:
            self.test_001()
            ba=Page2(self.dr)
            logging.debug('执行第二条用例')
            ba.yx()
        except Exception as e:
            s = time.strftime('%Y%m%d%H%M%S')
            self.dr.save_screenshot(s+'.png')
            print(e)
    def test_003(self):
        try:
            self.test_001()
            ba=Page3(self.dr)
            logging.debug('执行第三条用例')
            ba.yx()
        except Exception as e:
            s = time.strftime('%Y%m%d%H%M%S')
            self.dr.save_screenshot(s+'.png')
            print(e)